package com.chenwenxuan.sync.ui.editor.desginer;

import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JTabbedPane;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import com.jgoodies.forms.factories.FormFactory;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import java.awt.FlowLayout;
import javax.swing.JRadioButton;
import java.awt.Dimension;
import javax.swing.JCheckBox;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;

public class _TaskPanel extends JPanel {

	private static final long serialVersionUID = -3845520851758261135L;
	private JTextField txtTaskName;
	private JTextField txtExecuteCond;
	private JTable table;
	private JTextField txtParamNameBuffer;
	private JTextField txtEmailTitle;
	private JTextField txtEmailReceiver;

	public _TaskPanel() {
		setLayout(new BorderLayout(0, 0));
		
		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM);
		add(tabbedPane, BorderLayout.CENTER);
		
		JPanel panel = new JPanel();
		tabbedPane.addTab("\u4EFB\u52A1\u8BE6\u60C5", null, panel, null);
		panel.setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("left:default:grow"),
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,}));
		
		JLabel lblNewLabel = new JLabel("\u4EFB\u52A1\u540D\u79F0\uFF1A");
		panel.add(lblNewLabel, "2, 2, right, default");
		
		txtTaskName = new JTextField();
		panel.add(txtTaskName, "4, 2, fill, default");
		txtTaskName.setColumns(10);
		
		JLabel label = new JLabel("\u4EFB\u52A1\u7C7B\u578B\uFF1A");
		panel.add(label, "2, 4, right, default");
		
		JComboBox combTaskType = new JComboBox();
		panel.add(combTaskType, "4, 4, fill, default");
		
		JButton btnNewButton = new JButton("+");
		panel.add(btnNewButton, "6, 4");
		
		JLabel label_1 = new JLabel("\u8C03\u5EA6\u7C7B\u578B\uFF1A");
		panel.add(label_1, "2, 6");
		
		JPanel panel_2 = new JPanel();
		panel.add(panel_2, "4, 6, left, fill");
		panel_2.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		JRadioButton rdbtnFixJob = new JRadioButton("\u5B9A\u65F6\u4EFB\u52A1");
		panel_2.add(rdbtnFixJob);
		
		JRadioButton rdbtnCronJob = new JRadioButton("CRON\u5B9A\u65F6\u4EFB\u52A1");
		panel_2.add(rdbtnCronJob);
		
		JLabel lblNewLabel_1 = new JLabel("\u6267\u884C\u6761\u4EF6\uFF1A");
		panel.add(lblNewLabel_1, "2, 8, right, default");
		
		txtExecuteCond = new JTextField();
		panel.add(txtExecuteCond, "4, 8, fill, default");
		txtExecuteCond.setColumns(10);
		
		JButton btnNewButton_1 = new JButton("+");
		btnNewButton_1.setMaximumSize(new Dimension(25, 25));
		btnNewButton_1.setPreferredSize(new Dimension(25, 25));
		panel.add(btnNewButton_1, "6, 8");
		
		JLabel label_2 = new JLabel("\u524D\u7F6E\u6761\u4EF6\uFF1A");
		panel.add(label_2, "2, 10");
		
		JPanel panel_5 = new JPanel();
		panel.add(panel_5, "4, 10, left, fill");
		panel_5.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		JRadioButton rdbtnBeforeCondOnScriptSuccess = new JRadioButton("\u811A\u672C\u6267\u884C\u6210\u529F");
		panel_5.add(rdbtnBeforeCondOnScriptSuccess);
		
		JRadioButton rdbtnBeforeCondOnFileExists = new JRadioButton("\u6587\u4EF6\u5B58\u5728");
		panel_5.add(rdbtnBeforeCondOnFileExists);
		
		JButton btnNewButton_2 = new JButton("+");
		panel.add(btnNewButton_2, "6, 10");
		
		JLabel label_3 = new JLabel("\u7EC8\u6B62\u6761\u4EF6\uFF1A");
		panel.add(label_3, "2, 12");
		
		JPanel panel_7 = new JPanel();
		panel.add(panel_7, "4, 12, left, fill");
		panel_7.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		JRadioButton rdbtnAfterCondOnScriptSuccess = new JRadioButton("\u811A\u672C\u6267\u884C\u6210\u529F");
		panel_7.add(rdbtnAfterCondOnScriptSuccess);
		
		JRadioButton rdbtnAfterCondOnFileExists = new JRadioButton("\u6587\u4EF6\u5B58\u5728");
		panel_7.add(rdbtnAfterCondOnFileExists);
		
		JRadioButton rdbtnAfterCondDefault = new JRadioButton("\u9ED8\u8BA4");
		panel_7.add(rdbtnAfterCondDefault);
		
		JRadioButton rdbtnAfterCondNormal = new JRadioButton("\u6B63\u5E38\u5904\u7406");
		panel_7.add(rdbtnAfterCondNormal);
		
		JButton button = new JButton("+");
		panel.add(button, "6, 12");
		
		JPanel panel_1 = new JPanel();
		panel.add(panel_1, "4, 14, left, fill");
		panel_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		JCheckBox chkDetailLog = new JCheckBox("\u8BB0\u5F55\u8BE6\u7EC6\u65E5\u5FD7");
		panel_1.add(chkDetailLog);
		
		JCheckBox chkEnable = new JCheckBox("\u542F\u7528");
		panel_1.add(chkEnable);
		
		JPanel panel_4 = new JPanel();
		tabbedPane.addTab("\u4EFB\u52A1\u53C2\u6570", null, panel_4, null);
		panel_4.setLayout(new BorderLayout(0, 0));
		
		JSplitPane splitPane = new JSplitPane();
		splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
		panel_4.add(splitPane, BorderLayout.CENTER);
		
		JScrollPane scrollPane = new JScrollPane();
		splitPane.setLeftComponent(scrollPane);
		
		table = new JTable();
		scrollPane.setViewportView(table);
		
		JScrollPane scrollPane_1 = new JScrollPane();
		splitPane.setRightComponent(scrollPane_1);
		
		JPanel panel_3 = new JPanel();
		scrollPane_1.setViewportView(panel_3);
		panel_3.setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("default:grow"),},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,}));
		
		JLabel label_4 = new JLabel("\u53C2\u6570\u540D\u79F0\uFF1A");
		panel_3.add(label_4, "2, 2, right, default");
		
		txtParamNameBuffer = new JTextField();
		panel_3.add(txtParamNameBuffer, "4, 2, fill, default");
		txtParamNameBuffer.setColumns(10);
		
		JLabel label_5 = new JLabel("\u53C2\u6570\u503C\uFF1A");
		panel_3.add(label_5, "2, 4");
		
		splitPane.setDividerLocation(200);
		
		JPanel panel_6 = new JPanel();
		tabbedPane.addTab("\u90AE\u4EF6\u914D\u7F6E", null, panel_6, null);
		panel_6.setLayout(new BorderLayout(0, 0));
		
		JCheckBox chkEnableEmail = new JCheckBox("\u542F\u7528\u90AE\u4EF6");
		panel_6.add(chkEnableEmail, BorderLayout.NORTH);
		
		JPanel panel_8 = new JPanel();
		panel_6.add(panel_8, BorderLayout.CENTER);
		panel_8.setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("default:grow"),
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				RowSpec.decode("default:grow"),
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,}));
		
		JLabel lblNewLabel_2 = new JLabel("\u90AE\u4EF6\u6807\u9898\uFF1A");
		panel_8.add(lblNewLabel_2, "2, 2, right, default");
		
		txtEmailTitle = new JTextField();
		panel_8.add(txtEmailTitle, "4, 2, fill, default");
		txtEmailTitle.setColumns(10);
		
		JLabel lblNewLabel_3 = new JLabel("\u6536\u4EF6\u4EBA\uFF1A");
		panel_8.add(lblNewLabel_3, "2, 4, right, default");
		
		txtEmailReceiver = new JTextField();
		panel_8.add(txtEmailReceiver, "4, 4, fill, default");
		txtEmailReceiver.setColumns(10);
		
		JPanel panel_9 = new JPanel();
		panel_8.add(panel_9, "2, 6, 3, 1, fill, fill");
		panel_9.setLayout(new BorderLayout(0, 0));
		
		JScrollPane scrollPane_2 = new JScrollPane();
		panel_9.add(scrollPane_2, BorderLayout.CENTER);
		
		JTextArea txtEmailContent = new JTextArea();
		scrollPane_2.setViewportView(txtEmailContent);

	}

}
